home *** CD-ROM | disk | FTP | other *** search
/ Explorers of the New World / Explorers of the New World.iso / pc / exhelp.dir / 00033_BUILD INDEX.ls < prev    next >
Encoding:
Text File  |  1995-09-06  |  1.8 KB  |  48 lines

  1. on buildIndex fromCast, toCast
  2.   repeat with i = fromCast to toCast
  3.     set currentField to the text of cast i
  4.     repeat with j = 1 to the number of words in currentField
  5.       set currentWord to word j of currentField
  6.       if not ignorableWord(currentWord) then
  7.         if endsWithPunctuation(currentWord) then
  8.           set currentWord to removePunctuation(currentWord)
  9.         end if
  10.         set indexCast to the number of cast (currentWord && "INDEX")
  11.         if indexCast <> -1 then
  12.           set temp to the text of cast indexCast
  13.           put RETURN & the name of cast i after temp
  14.           put temp into field indexCast
  15.           next repeat
  16.         end if
  17.         set newFieldNumber to findEmpty(cast (toCast + 5))
  18.         put the name of cast i into field newFieldNumber
  19.         set the name of cast newFieldNumber to currentWord && "INDEX"
  20.       end if
  21.     end repeat
  22.   end repeat
  23. end
  24.  
  25. on alphabetizeCasts fromCast, toCast
  26.   set tempCast to findEmpty(cast toCast)
  27.   put "TEMP" into field tempCast
  28.   set the name of cast tempCast to "tempCast"
  29.   repeat with i = fromCast to toCast - 1
  30.     repeat with j = i + 1 to toCast - 1
  31.       set firstCast to i
  32.       set secondCast to j
  33.       set firstName to the name of cast firstCast
  34.       set secondName to the name of cast secondCast
  35.       if firstName > secondName then
  36.         set the name of cast tempCast to the name of cast firstCast
  37.         put the text of cast firstCast into field tempCast
  38.         set the name of cast firstCast to the name of cast secondCast
  39.         put the text of cast secondCast into field firstCast
  40.         set the name of cast secondCast to the name of cast tempCast
  41.         put the text of cast tempCast into field secondCast
  42.         set the name of cast tempCast to "tempCast"
  43.         put "TEMP" into field tempCast
  44.       end if
  45.     end repeat
  46.   end repeat
  47. end
  48.